package 剑指offer.demo6;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

//https://www.nowcoder.com/practice/e02fdb54d7524710a7d664d082bb7811?
public class 数组中只出现一次的数字 {
    public void FindNumsAppearOnce(int [] array,int num1[] , int num2[]) {
        Map<Integer , Integer> map = new HashMap<>();
        int[] a = new int[2];
        int j = 0;
        for (int i = 0 ; i < array.length ; i++){
            map.put(array[i] , map.getOrDefault(array[i] , 1) + 1);
        }
        for (Map.Entry<Integer , Integer> set : map.entrySet()
             ) {
            if (set.getValue() == 2){
                a[j++] = set.getKey();
            }
        }
        num1[0] = a[0];
        num2[0] = a[1];
    }
}
